package com.inspur.system.service.impl;

import java.util.List;

import com.inspur.common.utils.SecurityUtils;
import com.inspur.system.dto.ProNumDTO;
import com.inspur.system.service.IPmDynService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.inspur.system.mapper.PmDynMapper;
import com.inspur.system.domain.PmDyn;

/**
 * 动态Service业务层处理
 * 
 * @author lihaodong
 * @date 2024-04-10
 */
@Service
public class PmDynServiceImpl implements IPmDynService
{
    @Autowired
    private PmDynMapper pmDynMapper;

    /**
     * 查询动态
     * 
     * @param cDynNo 动态主键
     * @return 动态
     */
    public PmDyn selectPmDynByCDynNo(Long cDynNo)
    {
        return pmDynMapper.selectPmDynByCDynNo(cDynNo);
    }

    /**
     * 查询动态
     *
     * @param pmDyn
     * @return 动态
     */
    public List<PmDyn> selectPmDynByCPmNo(PmDyn pmDyn)
    {
        return pmDynMapper.selectPmDynByCPmNo(pmDyn);
    }

    /**
     * 查询动态列表
     * 
     * @param pmDyn 动态
     * @return 动态
     */
    public List<PmDyn> selectPmDynList(PmDyn pmDyn)
    {
        return pmDynMapper.selectPmDynList(pmDyn);
    }

    /**
     * 新增动态
     * 
     * @param pmDyn 动态
     * @return 结果
     */
    public int insertPmDyn(PmDyn pmDyn)
    {
        pmDyn.setcDynPer(SecurityUtils.getUserId()+"");
        pmDyn.setcCrePer(SecurityUtils.getUserId()+"");
        return pmDynMapper.insertPmDyn(pmDyn);
    }

    /**
     * 修改动态
     * 
     * @param pmDyn 动态
     * @return 结果
     */
    public int updatePmDyn(PmDyn pmDyn)
    {
        return pmDynMapper.updatePmDyn(pmDyn);
    }

    /**
     * 批量删除动态
     * 
     * @param cDynNos 需要删除的动态主键
     * @return 结果
     */
    public int deletePmDynByCDynNos(Long[] cDynNos)
    {
        return pmDynMapper.deletePmDynByCDynNos(cDynNos);
    }

    /**
     * 删除动态信息
     * 
     * @param cDynNo 动态主键
     * @return 结果
     */
    public int deletePmDynByCDynNo(Long cDynNo)
    {
        return pmDynMapper.deletePmDynByCDynNo(cDynNo);
    }

    @Override
    public ProNumDTO selectPmDynNum(String cPmNo)
    {
        return pmDynMapper.selectPmDynNum(cPmNo);
    }
}
